<template>
  <div>
    <p>ref demo {{ageRef}} {{state.name}}</p>
  </div>
</template>

<script>
import {
  ref,
  reactive
} from 'vue'
export default {
  setup() {
    const ageRef = ref(20) // 值类型响应式
    const nameRef = ref('cheng')

    const state = reactive({
      name: nameRef
    })

    setTimeout(() => {
      console.log('ageRef', ageRef.value)
      ageRef.value = 25 // .value 修改值
      nameRef.value = 'liang'
    }, 1500)

    return {
      ageRef,
      state
    }
  }
}
</script>